package cosc617_blackteam;

import java.util.Iterator;
/**
 * 
 * @author sherbahadur
 *This class is basically described as: order is prepared based on minutes to cook time.
 *The less minutes it takes, the faster it is cooked before others.
 *Much more complicated algorithms can be developed based on reality, however, to implement a 
 *simple strategy pattern, only one dimensional consideration of minutes to cook item 
 *is factored here. Other considerations such as when was the item ordered , what priority should
 *we give to orders that has been in the order queue for certain time is not considered here which
 *would factor in preparing food in real time.
 */
public class PrepByPrepTime implements I_CookingStrategy {
private OrderCollections orderList;

public PrepByPrepTime(OrderCollections orders){
	this.orderList=orders;
}
	@Override
	public void prepareFood() {
		
		Iterator<Order> iterator = orderList.sortedUnmadeIterator();
		if(iterator.hasNext()){
			Order order = iterator.next();
			order.decrementCookTime();
		
		}
		
	}
	
}
